<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RenderBlock
 *
 * @author NguyenVanTien
 */
class Zend_View_Helper_RenderBlock extends Zend_View_Helper_Abstract {
  
    public function renderBlock($name, $view){
        $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
        $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
        
        //set action default
        if(empty ($action)){
            $action = 'index';
        }
        //echo APPLICATION_PATH.'/views/scripts/'.$controller.'/block'; die;
        $view->addScriptPath(APPLICATION_PATH.'/views/scripts/'.$controller.'/block/'.$action);
        return $view->render($name.'.phtml');
    }
}